//
//  LogeInViewController.m
//  Youhuiju
//
//  Created by liuovyue on 16/8/4.
//  Copyright © 2016年 yutenys. All rights reserved.
//

#import "LogeInViewController.h"
#import "ForgetViewController.h"
#import "SecurityCenterViewController.h"
#import "RegisiterViewController.h"
#import "YHJMyCenterViewController.h"
#import "YORequestHander.h"

@interface LogeInViewController ()

@property (strong, nonatomic) IBOutlet UIButton *buttonLogeIn;//登录

@property (strong, nonatomic) IBOutlet UIButton *buttonReturn;//返回上一页按钮
@property (strong, nonatomic) IBOutlet UITextField *textFieldName;//账户名字
@property (strong, nonatomic) IBOutlet UITextField *textFieldPassWord;//密码
@property (strong, nonatomic) IBOutlet UIButton *butttonRegister;//注册按钮
@property (strong, nonatomic) IBOutlet UIView *viewName;

@property (strong, nonatomic) IBOutlet UIView *viewPassWord;
@property (strong, nonatomic) IBOutlet UILabel *labelTitle;

@property (strong, nonatomic) IBOutlet NSLayoutConstraint *registeredWidth;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *logeWidth;
@property(nonatomic,strong)YORequestHander *requestHander;//网络请求

@end

@implementation LogeInViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    self.logeWidth.constant = 341*FitW;
    self.registeredWidth.constant = 341*FitW;
    self.tabBarController.tabBar.hidden = YES;
    [self creteView];


    


}
//释放键盘
- (IBAction)firstResponderAction:(id)sender {
    
    [[UIApplication sharedApplication]sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil];
    
}

- (void)getData {
    
    NSLog(@"fffdss");
    NSDictionary *param = @{@"cusId":@"ddd",
                            @"cusPass":@"ffff"};
   
    
    [self.requestHander getWithAPIName:LoginAPI apiVersion:nil parameters:param cachIdentifier:nil success:^(id response) {
        DLog(@"请求成功~~~~~~~~~~~~response:%@",response);
        
        NSLog(@"登录成功");
       
        
    } failure:^(NSString *errorMessage) {
        DLog(@"请求失败~~~~~~~~~~~~error:%@",errorMessage);
        
    }];
    
    
    
    
    
}
- (void)creteView {
    
    self.labelTitle.textColor = [UIColor colorWithHexString:@"ff5f7b"];
    
    //返回键
    [self.buttonReturn setImage:[UIImage imageNamed:@"zfanhuijian"] forState:UIControlStateNormal];
    
    //下划线颜色
    self.viewName.backgroundColor =[UIColor colorWithHexString:@"eeeeee"];
    
    self.viewPassWord.backgroundColor = [UIColor colorWithHexString:@"eeeeee"];
    //self.textFieldName.textColor =[UIColor colorWithHexString:@"999999"];
    //self.textFieldPassWord.textColor = [UIColor colorWithHexString:@"999999"];
    
    
    [self.buttonLogeIn.layer setMasksToBounds:YES];
    [self.buttonLogeIn.layer setBorderWidth:1.0];
   
    
    
    self.buttonLogeIn.layer.borderColor = [UIColor whiteColor].CGColor;
    [self.buttonLogeIn.layer setCornerRadius:2.0];
    [self.butttonRegister.layer setMasksToBounds:YES];
    [self.butttonRegister.layer setBorderWidth:1.0];
  
    self.butttonRegister.tintColor = [UIColor colorWithHexString:@"ff5f7b"];
    self.butttonRegister.layer.borderColor = [UIColor whiteColor].CGColor;
    [self.butttonRegister.layer setCornerRadius:2.0];
}

- (IBAction)buttonReternAction:(id)sender {
     self.tabBarController.tabBar.hidden = NO;
   // YHJMyCenterViewController *mycenter = [[YHJMyCenterViewController alloc]init];
    //[self.navigationController pushViewController:mycenter animated:YES];
    [self.navigationController popViewControllerAnimated:YES];
    
}

- (IBAction)buttonLogeInAction:(id)sender {
    NSLog(@"登录");
    [self getData];
}

- (IBAction)buttonRegisterACtion:(id)sender {
    RegisiterViewController *registerView = [[RegisiterViewController alloc]init];
    [self.navigationController pushViewController:registerView animated:YES];




}
//忘记密码
- (IBAction)forgetAction:(id)sender {
    ForgetViewController *forget = [[ForgetViewController alloc]initWithNibName:@"ForgetViewController" bundle:nil];
    [self.navigationController pushViewController:forget animated:YES];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
